/**
 * Created by win10 on 2017/5/29.
 */
$(document).ready(function(){
    //家风家训下拉收起
    var height = $('.family-precepts-content p').height();
    var data = 52;
    if(height>data){
        var flag = false;
        $('.family-precepts-content p').css({
            "height":"52px",
            "overflow":"hidden"
        });
        $('.all-precepts').show();
        $('.all-precepts').on('click',function(){
            if(!flag){
                $('.all-precepts span').text('收起');
                $('.family-precepts-content').css({
                    "overflow":"visible",
                    "height":"100%"
                });
                $('.family-precepts-content p').css({
                    "height":"100%",
                    "overflow":"visible"
                });
                flag = !flag;
            }else{
                $('.all-precepts span').text('查看全部');
                $('.family-precepts-content p').css({
                    "height":"52px",
                    "overflow":"hidden"
                });
                flag = !flag;
            }
        });
    }

    //全部成员查看
    var $li = $('.member-list-ul li');
    if($li.length>3){
        var flags = false;
        $('.all-members').show();
        for(var i=3;i<$li.length;i++){
            $li.eq(i).css('display','none');
        }
        $('.all-members').on('click',function(){
            if(!flags){
                $('.all-members span').text('收起');
                for(var i=3;i<$li.length;i++){
                    $li.eq(i).css('display','block');
                }
                flags = !flags;
            }else{
                $('.all-members span').text('查看全部');
                for(var i=3;i<$li.length;i++){
                    $li.eq(i).css('display','none');
                }
                flags = !flags;
            }
        })
    }
});